import java.math.BigDecimal;
import java.util.Calendar;


public class Salary extends Item{
	private BigDecimal amt;
	private Calendar nextPayDate;
    private static final String[] monthName = {"January", "February",
            "March", "April", "May", "June", "July",
            "August", "September", "October", "November",
            "December"};

	
	public Salary(BigDecimal amt, Calendar lastPaidDate, Calendar nextPayDate){
		super("Salary", lastPaidDate,0);
		
		this.setAmt(amt);
		this.setNextPayDate(nextPayDate);
	}
	
	public BigDecimal getAmt() {
		return amt;
	}

	public void setAmt(BigDecimal amt) {
		this.amt = amt;
	}
	
	public void setLastPaidDate(Calendar lastPaidDate) {
		this.date = lastPaidDate;

	}
	
	public Calendar getLastPaidDate(){
		return date;
	}
	
	public Calendar getNextPayDate() {
		return nextPayDate;
	}

	public void setNextPayDate(Calendar nextPayDate) {
		this.nextPayDate = nextPayDate;
	}
	
	/*
	 * This method updates the salary next pay month by 1 
	 * and returns the month name (string) of the month of the salary being paid 
	 * */
	
	public String paySalary(Calendar date){
        setLastPaidDate(date);
		String currentPayMonth=monthName[nextPayDate.get(Calendar.MONTH)];
		currentPayMonth+=(" "+nextPayDate.get(Calendar.YEAR));
		nextPayDate.add(Calendar.MONTH, 1);
		
		return currentPayMonth;
	}


}
